package temp.lho.lws.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import temp.lho.lws.mapper.IBaseMapper;
import temp.lho.lws.mapper.SurveyLossInfoMapper;
import temp.lho.lws.pojo.SurveyLossInfo;
import temp.lho.lws.service.ICarDamageInfoService;
import temp.lho.lws.service.IHumanInjuryInfoService;
import temp.lho.lws.service.IObjectDamageInfoService;
import temp.lho.lws.service.ISurveyLossInfoService;

/**
 * (SurveyLossInfo)表服务实现类
 *
 * @author makejava
 * @since 2020-07-06 23:15:37
 */
@Service("surveyLossInfoService")
public class SurveyLossInfoServiceImpl extends BaseServiceImpl<SurveyLossInfo> implements ISurveyLossInfoService {

    //dao对象
    @Autowired
    private SurveyLossInfoMapper surveyLossInfoMapper;

    //车损、物损、人伤
    @Autowired
    private ICarDamageInfoService carDamageInfoService;
    @Autowired
    private IObjectDamageInfoService objectDamageInfoService;
    @Autowired
    private IHumanInjuryInfoService humanInjuryInfoService;

    @Override
    protected IBaseMapper<SurveyLossInfo> baseMapper() {
        return surveyLossInfoMapper;
    }

    @Override
    public int add(SurveyLossInfo surveyLossInfo) {
        //添加之前先删除
        surveyLossInfoMapper.deleteByClaimMainId(surveyLossInfo.getClaimmainid());
        //添加车损、物损、人伤信息

        return surveyLossInfoMapper.add(surveyLossInfo);
    }

    @Override
    public SurveyLossInfo findByClaimMainId(Integer claimmainid) {
        return surveyLossInfoMapper.findByClaimMainId(claimmainid);
    }
}